package com.glp.work.flow.constant;

import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

@Getter
public enum TaskingType {
    /**
     * 任务分配规则
     */
    NONE("0", "无"),
    SUBMIT_SCOPE("1", "按提交人限制业务范围"),
    LAST_POST_SCOPE("2", "按上一岗限制业务范围"),
    SUBMIT_COLLAR("3", "按提交人限制上下级"),
    LAST_POST_COLLAR("4", "按上一岗限制业上下级");

    private String code;
    private String remark;

    TaskingType(String code, String remark) {
        this.code = code;
        this.remark = remark;
    }

    public static TaskingType getEnum(String code) {
        if (StringUtils.isNotBlank(code)) {
            for (TaskingType os : values()) {
                if (code.equals(os.getCode())) {
                    return os;
                }
            }
        }
        return null;
    }
}
